package com.qqtech.qquan.push.enums;

public enum PushTypeEnum {

	ALERT(1, "通知"), MESSAGE(2, "自定义消息"), ALERTNMESSAGE(3, "通知及自定义消息");
	private int code;
	private String desc;

	private PushTypeEnum(int code, String desc) {
		this.desc = desc;
		this.code = code;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public static String getDesc(Integer code) {
		PushTypeEnum statusEnum = getInstance(code);
		if (statusEnum != null) {
			return statusEnum.getDesc();
		}
		return "";
	}

	public static PushTypeEnum getInstance(Integer code) {
		if (code != null) {
			for (PushTypeEnum statusEnum : PushTypeEnum.values()) {
				if (code.equals(statusEnum.getCode())) {
					return statusEnum;
				}
			}
		}
		return null;
	}
}
